#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(int argc,char* argv[])
{
    //printf("exec.c\n");
    printf("process is running...\n");
    pid_t id = fork();
    
    if(id == 0)
    {
        sleep(1);
    //    extern char** environ;
    //    //char* const env_[] = {(char*)"myenv=1111111",NULL};
    //    putenv((char*)"myenv=11111111111");
    //    execle("./mybin","mybin",NULL,environ);
        execvp(argv[1],&argv[1]);
        exit(10);
    }

    int status = 0;
    pid_t ret = waitpid(id,&status,0);
    if(ret == id)
    {
        printf("child exit, exit_code:%d,sig:%d\n",(status>>8) & 0xFF,status & 0x7F);
    }
    return 0;
}
